<?php
/**
 * 后台系统首页
 * Date: 2015/9/8
 * Time: 14:54
 */

namespace AdminV3\Controller;
use Think\Controller;

class ConsoleController extends CommonController
{
    public function index()
    {
        //获取当前角色 能使用的模块名列表, 传递到页面. 然后页面模块判断 其值是否在模块名列表内,ture 显示  false 不显示.
        $nodeList = M('access')->where('level = 2 and role_id ="'.session('roleid').'"')->field('node_id')->select();
        $nodeList = array_column($nodeList,'node_id');
        $nodeList = implode(',',$nodeList);
        $this->assign('node_id',$nodeList);

        $node = M('node')->where('level =2')->select();
        foreach($node as $v){
            $this->assign($v['name'],$v['id']);
        }

        //$this->display('index2');
        $this->display();
    }
}

